/**
 * title: A2
 */
// import styles from './a2.css';
import { NavLink } from 'umi';
import router from 'umi/router';
import withBreadcrumbs from 'react-router-breadcrumbs-hoc';

const routes = [
  { path: '/', breadcrumb: '首页' },
  { path: '/list', breadcrumb: 'List Page' },
];

export default withBreadcrumbs(routes)(({ breadcrumbs }) => {
  return (
    <div>
      {breadcrumbs.map((breadcrumb, index) => {
        return (
          <span key={breadcrumb.key}>
            <NavLink to={breadcrumb.match.url}>{breadcrumb.breadcrumb.props.children}</NavLink>
            {index < breadcrumbs.length - 1 && <i> / </i>}
          </span>
        );
      })}
      <br />
      <br />
      <button
        onClick={() => {
          router.goBack();
        }}
      >
        后退
      </button>
      <br />
      <form action="/api/random" method="post">
        <button type="submit">提交</button>
      </form>
    </div>
  );
});
